package com.example.k12.bean

import com.example.k12.utlis.AppConfig
import java.util.UUID

/**
 * 申请扣款接口 请求对象，申请扣款接口 请求对象
 */
data class OrderReq(
    /**
     * 支付模式
     */
    var paymentMode: Int? = AppConfig.instance.deviceInfo?.paymentMode,
    /**
     * 微信收款号ID
     */
    val accountId: Long? = null,

    val amount: Amount? = null,

    /**
     * 商品附加描述，长度不大于128
     */
    val attach: String? = null,

    /**
     * 支付凭证
     */
    val authCode: String? = null,

    val business: Business? = Business(),

    /**
     * 商品信息，长度不大于128
     */
    val description: String? = "test",

    /**
     * 设备id
     */
    val deviceId: Long? = AppConfig.instance.deviceId.toLong(),

    /**
     * 商品信息集合
     */
    val goodsList: List<Goods>? = arrayListOf(Goods()),

    /**
     * 优惠标记
     */
    val goodsTag: String? = null,

    /**
     * 订单产生原因
     */
    val orderSource: String? = null,

    /**
     * 订单uuid（设备上传保存）
     */
    val orderUuid: String? = UUID.randomUUID().toString(),

    /**
     * 商户订单号，长度不大于32
     */
    val outTradeNo: String? = null,

    val sceneInfo: SceneInfo? = SceneInfo(),
    val settleInfo: SettleInfo? = null,

    /**
     * 服务商公众号appid
     */
    val spAppid: String? = AppConfig.instance.deviceInfo?.payAppId,

    /**
     * 服务商商户号
     */
    val spMchid: String? = AppConfig.instance.deviceInfo?.payMchId,

    /**
     * 学生id
     */
    val studentId: String? = null,

    /**
     * 子商户公众号appid
     */
    val subAppid: String? = null,

    /**
     * 子商户商户号
     */
    val subMchid: String? = AppConfig.instance.deviceInfo?.subMchId
)

/**
 * Amount
 */
data class Amount(
    /**
     * 货币类型
     */
    val currency: String,

    /**
     * 用户支付货币类型
     */
    val payCurrency: String,

    /**
     * 用户支付金额
     */
    val payTotal: Long,

    /**
     * 订单金额
     */
    val total: Long
)

/**
 * Business
 */
data class Business(
    /**
     * 平台产品ID 2: K12项目 11: 企业团餐
     */
    val businessProductId: Long = 2,

    /**
     * 平台场景ID K12可选 3: 食堂 4: 超市 5: 校医院 6: K12测试场景企业团餐可选 124: 团餐测试 125: 企业食堂 126: 腾讯食堂
     */
    val businessSceneId: Long = 6
)

/**
 * Goods
 */
data class Goods(
    /**
     * 商品名称
     */
    val goodsName: String? = "ts",

    /**
     * 商品ID
     */
    val goodsVerId: Long? = 745888,

    /**
     * 购买数量
     */
    val number: Long = 1,

    /**
     * 单价
     */
    var unitPrice: Double = 0.01,

    /**
     * 总金额
     */
    var orderAmount: Double? = 0.01,

    /**
     * uuid list，长度与number一致
     */
    val slotUuids: List<String>? = arrayListOf(UUID.randomUUID().toString())
)

/**
 * SceneInfo
 */
data class SceneInfo(
    /**
     * 设备IP
     */
    val deviceIp: String = "172.16.15.165"
)

/**
 * SettleInfo
 */
data class SettleInfo(
    /**
     * 是否支持分账
     */
    val profitSharing: String? = null
)